package com.dinetech.dao;

import java.util.ArrayList;

import com.dinetech.ejecutor.R;
import com.dinetech.entidades.Galpon;


import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class GalponAdapter extends BaseAdapter {

       protected Activity activity;
       protected ArrayList<Galpon> items;
       int code;
       public GalponAdapter(Activity activity,ArrayList<Galpon> items){
       this.activity = activity;
       this.items = items;
       }
       
       
       
       @Override
       public int getCount() {
             
             return items.size();
       }

       @Override
       public Object getItem(int position) {
             // TODO Auto-generated method stub
             return items.get(position);
       }

       @Override
       public long getItemId(int position) {
             // TODO Auto-generated method stub
             return items.get(position).getIdGalpon();
       }

       @Override
       public View getView(int position, View convertView, ViewGroup parent) {
             View vi = convertView;
             
             if(convertView == null) {
             LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             vi = inflater.inflate(R.layout.spinner_selected_item, null);
        }
            
        Galpon item = items.get(position);        
        
        TextView txtdescripcion = (TextView) vi.findViewById(R.id.txtDescripcionGalpon);
        txtdescripcion.setText(item.getDescripcion());
        return vi;

       }

}

